package collections;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

//班级有n个小学生，70%概率抽男生，30%抽女生
//"沙耶松","帕姆","涵江","张天舒","范中航","文轩清","李德全","王国栋","张立伟"
//"君安肆","小叶榕","娜米玉","徐雅雯","许瑶",
public class Test2 {
    public static void main(String[] args) {
        //创建集合
        ArrayList<Integer> list = new ArrayList<>();
        //添加数据
        Collections.addAll(list,1,1,1,1,1,1,1);
        Collections.addAll(list,0,0,0);
        //打乱数据
        Collections.shuffle(list);
        //
        Random random = new Random();
        int index = random.nextInt(list.size());
        int number = list.get(index);
        System.out.println(number);
        //创建集合
        ArrayList<String> boyList = new ArrayList<>();
        ArrayList<String> girlList = new ArrayList<>();
        //add
        Collections.addAll(boyList,"沙耶松","帕姆","涵江","张天舒","范中航","文轩清","李德全","王国栋","张立伟");
        Collections.addAll(girlList,"君安肆","小叶榕","娜米玉","徐雅雯","许瑶");
        //
        if(number == 1){
            int i = random.nextInt(boyList.size());
            System.out.println(i);
            System.out.println(boyList.get(i));
        } else {
            int i = random.nextInt(girlList.size());
            System.out.println(i);
            System.out.println(girlList.get(i));
        }
    }
}
